/*
 *    Copyright (c) 2018-2025, bfcloud All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: bfcloud
 */

import request from '@/router/axios'

export function fetchList(query) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/page',
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/save',
    headers: {
      post: {
        "Content-Type": "applicationb/json"
      }
    },
    method: 'post',
    data: obj
  })
}

export function getObj(id) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/' + id,
    method: 'get'
  })
}

export function delObj(id) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/' + id,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb',
    method: 'put',
    data: obj
  })
}

export function updateById(obj) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/updateById',
    headers: {
      post: {
        "Content-Type": "applicationb/json"
      }
    },
    method: 'post',
    data: obj
  })
}

export function updateBm(obj) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/updateBm',
    method: 'put',
    data: obj
  })
}

export function updateGr(obj) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/updateGr',
    method: 'put',
    data: obj
  })
}

/**
 * 分配查看
 * @param {*} id
 * @returns
 */
export function workForlwRescind(id) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/view/' + id,
    method: 'get'
  })
}

/**
 * 发放查看
 * @param {*} id
 * @returns
 */
export function workForlwFf(id) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/viewff/' + id,
    method: 'get'
  })
}
export function viewRyDetail(id,deptId) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/viewRyDetail/' + id+ '/' + deptId,
    method: 'get'
  })
}
export function showProcess(id) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/showProcess/' + id,
    method: 'get'
  })
}
// /jiangjin/jiangjinfpjjfpdjb/showProcess/
/**
 * 月奖新增奖金
 * @param {*} obj
 * @returns
 */
export function saveYdjj(obj) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/saveYdjj',
    method: 'post',
    data: obj
  })
}
// 分配提审
export function sendFP(obj) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/sendFP',
    method: 'post',
    data: obj
  })
}
// 发放提审
export function sendFF(obj) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/sendFF',
    method: 'post',
    data: obj
  })
}
/**
 * 确认发放月奖保存逻辑
 * @param {*} id
 * @returns
 */
export function saveYjff(id) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/saveYjff/' + id,
    method: 'get'
  })
}
// 奖金发放新增拆分
export function updateBmFP4init(obj) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/updateBmFP4init',
    method: 'post',
    data: obj
  })
}
// 奖金修改联动
export function updateBmFP4Jjx(obj) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/updateBmFP4Jjx',
    method: 'post',
    data: obj
  })
}
/**
 * 恢复分配逻辑---已作废
 * @param zjFpId  主级分配ID
 * @param hfdFpId 恢复点分配ID
 * @returns
 */
export function saveRecovery(zjFpId, hfdFpId) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/saveRecovery/' + zjFpId + '/' + hfdFpId,
    method: 'get'
  })
}

/**
 * 查询分配子流程
 * @param fpId  分配ID
 * @returns
 */
export function selZjfpxx(fpId) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/selZjfpxx/' + fpId,
    method: 'get'
  })
}

/**
 * 分配分解
 * @param hfdFpId 恢复点分配ID
 * @param jjxIds 奖金项IDS
 * @returns
 */
export function saveDecompose(hfdFpId, jjxIds) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/saveDecompose/' + hfdFpId + '/' + jjxIds,
    method: 'get'
  })
}

//获取最新奖金公式数据
export function getGsData(query) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/getGsData',
    method: 'get',
    params: query
  })
}


//奖金分配提审
export function jjfpts(fpId) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/sendFP/' + fpId,
    method: 'post',
  })
}

// 获取指定分配id对应的奖金项详情
export function getJJItems(fpId) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/getjjxxq/' + fpId,
    method: 'get',
  })
}

// 获取指定分配id对应的下属部门奖金项分配详情
export function getJJDeptList(fpId) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/getbmfpxq/' + fpId,
    method: 'get',
  })
}

// 奖金分配--恢复分配
export function saveRecoveryNew(data) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/saveRecovery',
    method: 'post',
    data
  })
}
//奖金分配-判断当前用户是不是最后一级（人员）
export function getUserFlag(query) {
  return request({
    url: '/jiangjin/jiangjinfpjjbmfppzmxb/getUserFlag',
    method: 'get',
  })
}


export function getJiangJinFPTodoNum() {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/getJiangJinFPTodoNum',
    method: 'get',
  })
}

export function getApproversByUserId() {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/getApproversByUserId',
    method: 'get',
  })
}

export function setFileAdresstoJiangjin(query) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/setFileAdresstoJiangjin',
    method: 'get',
    params: query
  })
}
export function setDisabletoFileAdress(query) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/setDisabletoFileAdress',
    method: 'get',
    params: query
  })
}

export function getNodeInfo(id) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/getNodeInfo/' + id,
    method: 'get'
  })
}

export function confirmRole() {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/confirmRole',
    method: 'get'
  })
}

export function jiangjinFpApiSubmit(query) {
  return request({
    url: '/jiangjin/jiangjinFpApi/submit',
    method: 'get',
    params: query
  })
}

export function deleteJiangjinByimport(rowId) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/deleteJiangjinByimport/'+rowId,
    method: 'post',
  })
}

export function getJiangjinDataByImport(rowId) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/getJiangjinDataByImport/'+rowId,
    method: 'get',
  })
}

export function getFzGsData(jjid,deptId) {
  return request({
    url: '/jiangjin/jiangjinjjjgfz/getFzGsData/'+jjid+'/'+deptId,
    method: 'get',
  })
}

export function getMessageByprocessid(query) {
  return request({
    url: '/jiangjin/jiangjinfpjjbmfppzmxb/getMessageByprocessid',
    method: 'get',
    params: query
  })
}


export function getJiangJinAdminDblist(query) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/getJiangJinAdminDblist',
    method: 'get',
    params: query
  })
}

export function submitJJTaskt(obj) {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/submitJJTask',
    method: 'post',
    data: obj
  })
}

export function allTreeTwo() {
  return request({
    url: '/jiangjin/jiangjinfpjjfpdjb/allTree',
    method: 'get',
   // params: query
  })
}